<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS 层叠样式表完全指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* Hero 区域样式 */
        .hero-section {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            position: relative;
            overflow: hidden;
        }
        
        .hero-section::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: float 20s ease-in-out infinite;
        }
        
        @keyframes float {
            0%, 100% { transform: translate(0, 0) rotate(0deg); }
            50% { transform: translate(-30px, -30px) rotate(180deg); }
        }
        
        /* 内容卡片样式 */
        .content-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        
        .content-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
        }
        
        /* 代码块样式 */
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 12px;
            padding: 1.5rem;
            overflow-x: auto;
            position: relative;
            font-family: 'Consolas', 'Monaco', monospace;
        }
        
        .code-block::before {
            content: '';
            position: absolute;
            top: 10px;
            left: 15px;
            width: 12px;
            height: 12px;
            background: #ff5f56;
            border-radius: 50%;
            box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
        }
        
        /* 选择器示例样式 */
        .selector-example {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 2rem;
            border-radius: 15px;
            margin: 1rem 0;
            position: relative;
            overflow: hidden;
        }
        
        .selector-example::after {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
            animation: rotate 15s linear infinite;
        }
        
        @keyframes rotate {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* 属性卡片样式 */
        .property-card {
            background: white;
            border-radius: 12px;
            padding: 1.5rem;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        
        .property-card:hover {
            border-color: #667eea;
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
        }
        
        /* 首字下沉 */
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* 高亮文本 */
        .highlight {
            background: linear-gradient(120deg, #f093fb 0%, #f5576c 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-weight: 600;
        }
        
        /* 图表容器 */
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero 区域 -->
    <section class="hero-section relative py-20 px-6 text-white">
        <div class="container mx-auto max-w-6xl relative z-10">
            <h1 class="text-5xl md:text-7xl font-bold mb-6 animate-pulse">
                CSS <span class="text-yellow-300">层叠样式表</span>
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">
                掌握网页设计的核心技术，创造令人惊叹的视觉体验
            </p>
            <div class="flex flex-wrap gap-4">
                <div class="flex items-center gap-2 bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-layer-group"></i>
                    <span>样式层叠</span>
                </div>
                <div class="flex items-center gap-2 bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-paint-brush"></i>
                    <span>视觉设计</span>
                </div>
                <div class="flex items-center gap-2 bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-code"></i>
                    <span>前端开发</span>
                </div>
            </div>
        </div>
    </section>

    <!-- 主要内容区域 -->
    <main class="container mx-auto max-w-6xl px-6 py-12">
        
        <!-- CSS 概述 -->
        <section class="content-card p-8 mb-12">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-info-circle text-purple-600 mr-3"></i>CSS 概述
            </h2>
            <div class="prose prose-lg max-w-none">
                <p class="mb-4">
                    <span class="drop-cap">C</span>SS（Cascading Style Sheets）是现代网页设计的基石，它赋予了HTML结构以生命和美感。通过CSS，我们能够精确控制网页的视觉呈现，从简单的颜色和字体，到复杂的动画和响应式布局。
                </p>
                <div class="grid md:grid-cols-2 gap-6 mt-8">
                    <div class="property-card">
                        <h3 class="text-xl font-semibold mb-3 text-purple-700">
                            <i class="fas fa-palette mr-2"></i>样式定义
                        </h3>
                        <p class="text-gray-700">CSS定义了HTML元素的显示方式，包括颜色、大小、位置、动画等视觉属性。</p>
                    </div>
                    <div class="property-card">
                        <h3 class="text-xl font-semibold mb-3 text-purple-700">
                            <i class="fas fa-object-ungroup mr-2"></i>内容分离
                        </h3>
                        <p class="text-gray-700 text-red-600 font-semibold">解决内容与表现分离的问题，让HTML专注于结构，CSS专注于样式。</p>
                    </div>
                    <div class="property-card">
                        <h3 class="text-xl font-semibold mb-3 text-purple-700">
                            <i class="fas fa-layer-group mr-2"></i>样式层叠
                        </h3>
                        <p class="text-gray-700">多个样式定义可以层叠为一，按照特定的优先级规则应用到元素上。</p>
                    </div>
                    <div class="property-card">
                        <h3 class="text-xl font-semibold mb-3 text-purple-700">
                            <i class="fas fa-file-code mr-2"></i>样式表存储
                        </h3>
                        <p class="text-gray-700">样式通常存储在独立的样式表文件中，便于维护和复用。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- CSS 知识体系图 -->
        <section class="content-card p-8 mb-12">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-sitemap text-purple-600 mr-3"></i>CSS 知识体系
            </h2>
            <div class="mermaid">
                graph TD
                    A[CSS 核心概念] --> B[选择器]
                    A --> C[样式属性]
                    A --> D[布局系统]
                    A --> E[优先级规则]
                    
                    B --> B1[基础选择器]
                    B --> B2[组合选择器]
                    B --> B3[伪类选择器]
                    B --> B4[属性选择器]
                    
                    C --> C1[文本样式]
                    C --> C2[颜色背景]
                    C --> C3[边框阴影]
                    C --> C4[变换动画]
                    
                    D --> D1[盒子模型]
                    D --> D2[定位系统]
                    D --> D3[浮动布局]
                    D --> D4[Flex/Grid]
                    
                    E --> E1[内联样式]
                    E --> E2[内部样式]
                    E --> E3[外部样式]
                    E --> E4[!important]
                    
                    style A fill:#667eea,stroke:#fff,stroke-width:3px,color:#fff
                    style B fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style C fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style D fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style E fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
            </div>
        </section>

        <!-- 选择器详解 -->
        <section class="content-card p-8 mb-12">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-mouse-pointer text-purple-600 mr-3"></i>CSS 选择器
            </h2>
            <p class="text-lg text-gray-700 mb-8">选择器是CSS的核心，它决定了样式规则应用到哪些HTML元素上。掌握选择器的使用，是精确控制页面样式的关键。</p>
            
            <!-- 基础选择器 -->
            <div class="mb-12">
                <h3 class="text-2xl font-semibold mb-6 text-gray-800">基础选择器</h3>
                
                <div class="grid gap-6">
                    <!-- 通配符选择器 -->
                    <div class="selector-example">
                        <h4 class="text-xl font-bold mb-3">
                            <i class="fas fa-asterisk mr-2"></i>通配符选择器
                        </h4>
                        <div class="code-block mt-4">
                            <pre>* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}</pre>
                        </div>
                        <p class="mt-4 text-white opacity-90">选择页面上的所有元素，常用于重置默认样式。</p>
                    </div>
                    
                    <!-- 标签选择器 -->
                    <div class="selector-example" style="background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);">
                        <h4 class="text-xl font-bold mb-3">
                            <i class="fas fa-tag mr-2"></i>标签选择器
                        </h4>
                        <div class="code-block mt-4">
                            <pre>h1 {
    font-size: 2.5rem;
    color: #333;
}

p {
    line-height: 1.6;
    margin-bottom: 1rem;
}</pre>
                        </div>
                        <p class="mt-4 text-white opacity-90">直接选择HTML标签，应用于所有相同标签的元素。</p>
                    </div>
                    
                    <!-- 类选择器 -->
                    <div class="selector-example" style="background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);">
                        <h4 class="text-xl font-bold mb-3">
                            <i class="fas fa-dot-circle mr-2"></i>类选择器
                        </h4>
                        <div class="code-block mt-4">
                            <pre>.highlight {
    background-color: yellow;
    font-weight: bold;
}

.btn-primary {
    background: #667eea;
    color: white;
    padding: